/**
 * Copyright (C) 2024-2030 Super BilGen & 超亿时代信息技术股份有限公司.All Rights Reserved.
 */
package cn.com.yang.chain;

/**
 * @Model cn.com.yang.chain.AbstractLogger
 * @Desc 控制台日志
 * @author yangyijin
 * @since 2025年3月29日-上午10:29:46
 */
public abstract class AbstractLogger implements YLogger {

	public static int CONSOLE = 0;
	public static int DEBUG = 1;
	public static int INFO = 2;
	public static int ERROR = 3;

	protected int level;
	protected YLogger nextLogger;

	
	public AbstractLogger(int level) {
		this.level = level;
	}

	@Override
	public void setNextLogger(YLogger nextLogger) {
		this.nextLogger = nextLogger;
	}

	@Override
	public void logMessage(int level, String message) {
		if (this.level <= level) {
			log(message);
		}
		if (nextLogger != null) {
			nextLogger.logMessage(level, message);
		}
	}

	abstract protected void log(String message);
}
